package com.xxx.String;

import java.nio.charset.StandardCharsets;

/**
 * @version v1.0
 * @Description
 * @Author admin
 * @date 2021/7/19  9:33
 * @Copyright
 */
public class Encode {


    public static void main(String[] args) {
//        m1();
//        m2();
        String s1 = "abc";
        s1 = "cba";
        char c1 = '你';
        String s2 = new String("cab");//创建了两个对象
        System.out.println(c1 + 0);

    }

    private static void m2() {
        byte[] byte1 = {-21,-65,-96};
        String s2 = new String(byte1);
        System.out.println(s2);
    }

    private static void m1() {
        String s1 = "你";
        byte[] bytes =  s1.getBytes(StandardCharsets.UTF_8);
        for (int i = 0; i < bytes.length; i++) {
            System.out.println(bytes[i]);
        }
    }
}
